package com.zhentao.controller;

import com.zhentao.mapper.DishSalesFlowMapper;
import com.zhentao.pojo.DishSalesFlow;
import com.zhentao.service.DishSalesFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/dishxiaoshou")
public class DIshXiaoShouController {
    @Autowired
    private DishSalesFlowService dishSalesFlowService;
    @Autowired
    private DishSalesFlowMapper dishSalesFlowMapper;
    @RequestMapping("/addDishSalesFlow")
    public String addDishSalesFlow(DishSalesFlow dishSalesFlow){
        int insert = dishSalesFlowMapper.insert(dishSalesFlow);
        return insert>0?"添加成功":"添加失败";
    }
    @RequestMapping("/deleteDishSalesFlow")
    public String deleteDishSalesFlow(Integer salesFlowId){
        int delete = dishSalesFlowMapper.deleteById(salesFlowId);
        return delete>0?"删除成功":"删除失败";
    }
    @RequestMapping("/updateDishSalesFlow")
    public String updateDishSalesFlow(DishSalesFlow dishSalesFlow){
        int update = dishSalesFlowMapper.updateById(dishSalesFlow);
        return update>0?"修改成功":"修改失败";
    }
    @RequestMapping("/getDishSalesFlowById")
    public DishSalesFlow getDishSalesFlowById(Integer salesFlowId){
        return dishSalesFlowMapper.selectById(salesFlowId);
    }
}
